﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using NetCMS.DALFactory;
using NetCMS.Model;

namespace NetCMS.Content
{
    public class DefineTable
    {
        private IDefineTable dal;
        public DefineTable()
        {
            dal = NetCMS.DALFactory.DataAccess.CreateDefineTable();
        }
        #region DefineTable.aspx
        public DataTable Sel_DefineInfoId()
        {
            return dal.Sel_DefineInfoId();
        }
        public DataTable Sel_ParentInfo(string PID,int flag)
        {
            return dal.Sel_ParentInfo(PID,flag);
        }
        public int sel_defCname(string defCname)
        {
            return dal.sel_defCname(defCname);
        }

        public int sel_defEname(string defEname)
        {
            return dal.sel_defEname(defEname);
        }
        public int Add(string Str_ColumnsType, string defCname, string defEname, int definSelected, int Isnull, string defColumns, string defExp, string definedvalue, int DtType)
        {
            return dal.Add(Str_ColumnsType, defCname, defEname, definSelected, Isnull, defColumns, defExp, definedvalue,DtType);
        }
        #endregion

        #region DefineTable_Edit_List.aspx
        public DataTable Str_Start_Sql(int ID)
        {
            return dal.Str_Start_Sql(ID);
        }
        public int Update(string Str_ColumnsType, string Str_DefName, string Str_DefEname, string Str_DefType, int Str_DefIsNull, string Str_DefColumns, string Str_DefExpr, int DefID, string definedvalue, int type)
        {
            return dal.Update(Str_ColumnsType, Str_DefName, Str_DefEname, Str_DefType, Str_DefIsNull, Str_DefColumns, Str_DefExpr, DefID, definedvalue,type);
        }
        #endregion

        #region DefineTable_Edit_Manage.aspx
        public int update_defineClass(string Str_NewText, string DefID)
        {
            return dal.update_defineClass(Str_NewText, DefID);
        }
        #endregion

        #region DefineTable_List.aspx
        public DataTable GetPage(string defid, int PageIndex, int PageSize, out int RecordCount, out int PageCount, params SQLConditionInfo[] SqlCondition)
        {
            return dal.GetPage(defid, PageIndex,PageSize, out RecordCount, out PageCount, SqlCondition);
        }
        public int del_defineStr(string pr)
        {
            return dal.del_defineStr(pr);
        }
        public int del_deData(int DefID)
        {
            return dal.del_deData(DefID);
        }
        #endregion

        public int sel_defineClass(string _NewText,int flag)
        {
            return dal.sel_defineClass(_NewText,flag);
        }
        public int add_defineClass(string rand, string _NewText, string _PraText)
        {
            return dal.add_defineClass(rand, _NewText, _PraText);
        }
        public void del_defineClass(string DefID,int flag)
        {
            dal.del_defineClass(DefID, flag);
        }
        public int del_defClassInfo(int flag)
        {
            return dal.del_defClassInfo(flag);
        }
         //读取属于会员的自定义字段
        public DataTable getDefineUser(int type)
        {
            return dal.getDefineUser(type);
        }
        //添加修改会员自定义字段
        /// <summary>
        /// 
        /// </summary>
        /// <param name="DsnewsId">ID编号</param>
        /// <param name="DsEName">英文名称</param>
        /// <param name="DsnewsTable">保存会员信息表名字</param>
        /// <param name="DsType">自定义类型  系统默认后台数据为:0,前台为1 </param>
        /// <param name="DsContent">内容</param>
        /// <param name="DsApiId">API唯一编号</param>
        /// <param name="SiteID"></param>
        /// <returns></returns>
        public int AddUpdateDefine(int Id, string DsnewsId, string DsEName, string DsnewsTable, int DsType, string DsContent, string DsApiId, string SiteID, int flag)
        {
            return dal.AddUpdateDefine(Id, DsnewsId, DsEName, DsnewsTable, DsType, DsContent, DsApiId, SiteID,flag);
        }
        //根据会员编号和自定义字段类型读取自定义字段
        public DataTable setDefineByNum(string userNum)
        {
            return dal.setDefineByNum(userNum);
        }
    }
}